package butines.core.game;

import java.awt.Graphics2D;

public class BasicGame implements Game, InputListener {

	protected GameContext gameContext;
	protected Input input;
	protected Audio audio;
	
	public void init(GameContext gameContext) {
		this.gameContext = gameContext;
		audio = gameContext.getAudio();
		input = gameContext.getInput();
		input.addListener(this);
		initialise();
	}

	public void destroy() {
		release();
	}

	public void update(float t) {
		
	}

	public void render(Graphics2D g) {
		
	}
	
	protected void initialise() {
		
	}
	
	protected void release() {
		
	}

	public void onKey(int keyCode, boolean pressed, float tpf) {
		
	}

	public void onButton(int x, int y, int button, boolean pressed, float tpf) {
		
	}

	public void onMove(int x, int y, int dx, int dy, float tpf) {
		
	}
	
	public void onWheel(int x, int y, int wheel, float tpf) {
		
	}

	public void start() {
		GameContainer gameContainer = new GameContainer(this);
		gameContainer.setTargetFps(60);
		gameContainer.setResolution(320, 320, false);
		gameContainer.start();
	}
	
}
